<?php

namespace app\api\controller;

use \tpfcore\Core;

/**
 * @title 小程序订单接口类
 * @description
 * @group 小程序接口
 * Class Order
 * @package app\api\controller
 */
class Order extends ApiBase
{
    /**
     * @title       获取订单相关参数
     * @description 小程序订单参数获取
     * @author      TPFrame
     * @url         /api/order/getOrder/
     * @method POST
     * @param_send  name:api_version type:string require:1 default:空字符串"" other:格式x.x.x desc:版本号
     * @param_send  name:order_sn type:string require:1 default:空字符串"" other:格式x.x.x desc:订单号
     */
    public function getOrder()
    {
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->getOrder($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    /**
     * @title       创建订单
     * @description 小程序订单创建
     * @author      TPFrame
     * @url         /api/order/createOrder/
     * @method POST
     * @param_send  name:api_version type:string require:1 default:空字符串"" other:格式x.x.x desc:版本号
     * @param_send  name:openid type:string require:1 default:空字符串"" other:格式x.x.x desc:小程序openid
     */
    public function createOrder(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->createOrder($this->param));
                break;
            case '2.0':
                $this->jump(Core::loadModel('Order')->createRealOrder($this->param));
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    /**
     * @title       创建微信订单
     * @description 微信订单创建
     * @author      TPFrame
     * @url         /api/order/creatWechateOrder/
     * @method POST
     * @param_send  name:api_version type:string require:1 default:空字符串"" other:格式x.x.x desc:版本号
     */
    public function creatWechateOrder(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->creatWechateOrder($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }

    public function orderWechatList(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->orderWechatList($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    /**
     * @title       订单列表
     * @description 会员订单列表
     * @author      TPFrame
     * @url         /api/order/orderList/
     * @method POST
     * @param_send  name:api_version type:string require:1 default:空字符串"" other:格式x.x.x desc:版本号
     * @param_send  name:type type:string require:0 default:1 other:格式x.x.x desc:订单类型 1：全部；2：已完成；3已取消；4：代付款；5：待评价；
     */
    public function orderList(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->orderList($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    public function saveGoodsComment(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->saveGoodsComment($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    public function cancelOrder(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->cancelOrder($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    public function deleteOrder(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->deleteOrder($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    public function payOrder(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->payOrder($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    //提醒发货
    public function remindShip(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->remindShip($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
    // 获取订单信息
    public function getOrderInfo(){
        switch ($this->api_version) {
            case '1.0':
                $this->jump(Core::loadModel('Order')->getOrderInfo($this->param));
                break;
            default:
                $this->jump([40048, '版本号错误']);
                break;
        }
    }
}